﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using ZDSoft.QLMS.Entity.Rules;

namespace ZDSoft.QLMS.Entity
{
    [ActiveRecord]
    public class KnowledgePoint : EntityBase<KnowledgePoint>
    {
        //知识点名称
        [Property]
        public string Name { get; set; }

        //该知识点对应的课程
        [BelongsTo("CourseID")]
        public Course Course { get; set; }

        //备注
        [Property]
        public string Remark { get; set; }

        [Property]
        public bool IsActive { get; set; }

        /// <summary>
        /// 父级知识点
        /// </summary>
        [BelongsTo("ParentID")]
        public KnowledgePoint Parent { get; set; }

        /// <summary>
        /// 子级知识点
        /// </summary>
        [HasMany(typeof(KnowledgePoint), ColumnKey = "ParentID", Inverse = true)]
        public IList<KnowledgePoint> Children { get; set; }

        //该父级知识点拥有多个题目
        [HasMany(typeof(Question), ColumnKey = "KnowledgePointID", Inverse = true)]
        public IList<Question> Questions { get; set; }

        [HasMany(typeof(KnowledgePointRule), ColumnKey = "KnowledgePointID", Inverse = true)]
        public IList<KnowledgePointRule> KnowledgePointRules { get; set; }
    }
}
